import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

data = pd.read_csv("ms.csv", index_col=0)

fig = plt.figure()

ax = fig.add_subplot(1, 1, 1)

data50 = data['50'].to_list()
data_s = []
for i in range(100):
    data_s.append(np.mean(data50[:(i + 1)]))
plt.plot(data_s, label='Simulation value,T=50')
plt.plot([data50[101]] * 100, label='Theoretical value,T=50')

data100 = data['100'].to_list()
data_s = []
for i in range(100):
    data_s.append(np.mean(data100[:(i + 1)]))
plt.plot(data_s, label='Simulation value,T=100')
plt.plot([data100[101]] * 100, label='Theoretical value,T=100')

data200 = data['200'].to_list()
data_s = []
for i in range(100):
    data_s.append(np.mean(data200[:(i + 1)]))
plt.plot(data_s, label='Simulation value,T=200')
plt.plot([data200[101]] * 100, label='Theoretical value,T=200')

plt.legend(loc=[0.55, 0.6])
ax.get_yaxis().get_major_formatter().set_scientific(False)
ax.set_xlabel("T")
ax.set_ylabel("Availability")
plt.show()
fig.savefig("CompareMarkov.png", dpi=120)
